import { Inject, Injectable } from '@nestjs/common';
import { CreateArticleViewDto } from './dto/create-article-view.dto';
import { PrismaService } from 'src/prisma.service';

@Injectable()
export class ArticleViewService {
  @Inject()
  prismaService: PrismaService;
  async create(
    createArticleViewDto: CreateArticleViewDto,
    ip: string,
    userId?: number,
  ) {
    return await this.prismaService.articleView.create({
      data: {
        articleId: createArticleViewDto.articleId,
        ip,
        userId,
      },
    });
  }
}
